Skip to content

fix: replace invalid UTF-8 without losing subprocess output - #208

Open
omrzk wants to merge 1 commit into
pycontribs:mainfrom
omrzk:fix/replace-invalid-output-134
Open

omrzk wants to merge 1 commit into
pycontribs:mainfrom
omrzk:fix/replace-invalid-output-134

Conversation

@omrzk

@omrzk omrzk commented Nov 9, 2026

Copy link
Copy Markdown

An invalid UTF-8 byte stops the background stdout or stderr reader, losing the rest of that stream's captured output. Decode with replacement so both streams continue to be captured and displayed.

Fixes #134.

Real child-process tests cover invalid bytes followed by valid UTF-8 and later lines on both streams, normal/quiet/disabled tee output, and captured output on a nonzero exit with check=True. The four cases fail on current main and pass with the fix. Update the expected test count from 18 to 22 for these four added cases.

Validation: full Python 3.12 tox suite passes with 22 passed, 1 existing XPASS, and 81% coverage, including the Molecule/Ansible localhost scenario. Build, strict Twine validation and strict documentation build pass. Formatting, Ruff, Pyright, Pylint and spelling checks pass. The Mypy pre-commit hook fails identically on clean main because its unpinned pytest dependency uses Python 3.10 syntax while the configured target is 3.9; the same Mypy version passes the changed files with the repository's locked pytest 8.4. No native Windows or macOS run.

@omrzk
omrzk requested a review from ssbarnea as a code owner November 9, 2026 15:36
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Label error. Requires at least 1 of: breaking, chore, feat, fix. Found: . Follow https://www.conventionalcommits.org to get auto-labeling to work correctly.

@omrzk omrzk changed the title Replace invalid UTF-8 without losing subprocess output fix: replace invalid UTF-8 without losing subprocess output Nov 9, 2026
@omrzk

omrzk commented Nov 9, 2026

Copy link
Copy Markdown
Author

The title now uses fix:. The ack workflow only handles opened/labeled/unlabeled/synchronize events, so applying the fix label still needs a maintainer; I don't have triage permission here.

The other current failures are separate from that metadata correction: tox fails while building coactions/dynamic-matrix@v4, before this repository is checked out (cffi==1.17.1 under Python 3.15). Pre-commit CI reports the same pytest 9/Python 3.9-target Mypy syntax error reproduced on clean main and disclosed in the description. The local Python 3.12 tox run remains 22 passed, 1 existing XPASS; the code tree is unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle non- utf-8 characters

1 participant